/**
 * Created by XianTao on 2016/4/26
 * <p/>
 * Copyright (c) 2015-2015
 * Apache License
 * Version 2.0, January 2004
 * http://www.apache.org/licenses/
 */
package org.lego.wechat.portal.service;

import org.lego.wechat.base.msg.in.InMsg;
import org.lego.wechat.base.msg.out.OutMsg;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public interface WechatHandler extends Comparable<WechatHandler> {
    List<WechatHandler> allHandlers = new ArrayList<WechatHandler>();

    int getPriority();

    void setPriority(int priority);

    /**
     * 是否匹配对象
     *
     * @param inMsg
     * @return
     */
    boolean isMatch(InMsg inMsg);

    /**
     * 处理对象
     *
     * @param inMsg
     * @return 应答对象
     */
    OutMsg process(InMsg inMsg);

    /**
     * 获取自己的类
     */
    WechatHandler getMyself();
}
